﻿using System.Collections.Generic;
using System.Linq;
using Dexter.DataTransferObject;

namespace Dexter.Domain.Model {
	public static class PluginHelper {
		public static IList<PluginDto> ToDtos(this IList<Plugin> data) {
			return data.Select(x => x.ToDto()).ToList();
		}

		public static PluginDto ToDto(this Plugin plugin) {
			return new PluginDto()
			       	{
			       		Enabled = plugin.Enabled,
			       		Identifier = plugin.Identifier,
			       		IsInstalled = plugin.IsInstalled,
			       		Name = plugin.Name,
			       		RegistrationName = plugin.RegistrationName,
			       		Version = plugin.Version,
						Author = plugin.Author,
						Description = plugin.Description,
						Website = plugin.Website
			       	};
		}
	}
}